#InOut file:
#Contains all I/O functionality




#Import basic functionality
from Grid import *
from Exc import *
import string

#Text character representation class
#class TextInput(Grid):

def AskPerson(self):

    #Ask person to select difficulty
    Diff=raw_input('\nPlease select your difficulty from 1 to 4 (4 is impossible):')

    Diff=int(Diff)

    if Diff > 4 or Diff < 1:
        Diff = 4
    
    self.Diff=Diff

    #Ask person for character representation
    print 'Please select a character representation;'
    Person=raw_input('Your options is either \'X\' or \'O\'; \'X\' goes first:')


    #Capitalize char. rep.
    Human=string.upper(Person)

    #Check to make sure it is a valid choice
    if (Human == "X") or (Human == "O"):
        self.Human=Human
        
        
    else:
        raise IllegalMove

        
        

    #Assign other char. rep. to comp
    if Human == 'X':
        self.Comp='O'
    else:
        self.Comp='X'




#Should have named it AskMove; should fix in the future
def AskTurn(self):

    print 'You are %s' % (self.Human)

    #Ask person for move
    Pos=raw_input('\n\n\nPlease make a move:')

    #Figure out what move was chosen
    if Pos == '7':
        self.Move(self.Human, 0, 0)
        
    elif Pos == '8':
        self.Move(self.Human, 0, 1)

    elif Pos == '9':
        self.Move(self.Human, 0, 2)



    elif Pos == '4':
        self.Move(self.Human, 1, 0)

    elif Pos == '5':
        self.Move(self.Human, 1, 1)

    elif Pos == '6':
        self.Move(self.Human, 1, 2)

        

    elif Pos == '1':
        self.Move(self.Human, 2, 0)

    elif Pos == '2':
        self.Move(self.Human, 2, 1)

    elif Pos == '3':
        self.Move(self.Human, 2, 2)

    else:
        raise IllegalMove










#class TextOutput(Grid):

            #Might not need Output class:
            #Could probably be handled by exception class since that could output whether the game is over if there was a Cat's Game
            #And everything else falls under flow control
